*===============================================================================
*
*					WORKER BELIEFS ABOUT OUTSIDE OPTIONS
*		(c)	Simon Jaeger, Christopher Roth, Nina Roussille, Benjamin Schoefer
*							  2023 December 5
*						   	   	 Local Data 
*
*===============================================================================


********************************************************************************
*								Table E01									   *
********************************************************************************

clear 
  
use "$temp/robust.dta", clear
  
matrix J=J(15,6,.)

local j = 0

* recode to 1 0 instead of -1 0 and recode so that the benchmark is 1 and the alt is 0 
replace occupation_order = occupation_order + 1
replace soep_order = soep_order + 1

* Panel A (& 1 line Panel B)
foreach var in east uni_degree age_level female pretaxwageearncts ft_employed pct_wage_change_masslayoff{

	local ++j

	sum `var', d
	mat J[`j',1] = r(mean)
	mat J[`j',2] = r(sd)
	mat J[`j',3] = r(p25)
	mat J[`j',4] = r(p50)
	mat J[`j',5] = r(p75)
	mat J[`j',6] = r(N)

}

* Panel B 
* ! note that j from previous loop is still in use ! 
foreach splitvar in soep_order occupation_order timing_order{
	foreach val in 0 1{
		local ++j
		sum pct_wage_change_combined if `splitvar' == `val', d
		mat J[`j',1] = r(mean)
		mat J[`j',2] = r(sd)
		mat J[`j',3] = r(p25)
		mat J[`j',4] = r(p50)
		mat J[`j',5] = r(p75)
		mat J[`j',6] = r(N)
	}
}
* ! note that j from previous loop is still in use ! 
foreach val in "switchout_combined if soep_order == 1" "switchout_combined if soep_order == 0" {
	local ++j
	sum `val', d
	mat J[`j',1] = r(mean)
	mat J[`j',2] = r(sd)
	mat J[`j',3] = r(p25)
	mat J[`j',4] = r(p50)
	mat J[`j',5] = r(p75)
	mat J[`j',6] = r(N)	
}


frmttable using "$tab/TableE01.tex", fragment tex statmat(J) replace ///
ctitle("" , "Mean" ,"SD", "P25", " Median", "P75", "$ N $") ///
sdec(3,3,3,3,3,0\3,3,3,3,3,0\1,1,1,1,1,0\3,3,3,3,3,0\0,0,0,0,0,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0\3,3,3,3,3,0) ///
rtitles("\textbf{Panel A: Demographics and Labor Market Characteristics}  & \\ &  \\ East" ///
\ "University Degree" \ "Age in Years"  \ "Female" \ "Pre-Tax Wage (in EUR, per Month)" \ "Full-time Employed"  ///
\ "\\ \textbf{Panel B: Beliefs}  & \\ &  \\ Own Wage Change: Firm Closure Framing" \ "Own Wage Change: Two-Step Categorical Elicitation" \ "Own Wage Change: One-Step Elicitation About Level" \ "Own Wage Change: Conditioning on Occupation"  \ "Own Wage Change: Not Conditioning on Occupation" \ "Own Wage Change: 3 Months to Find a Job" \ "Own Wage Change: 12 Months to Find a Job"  \ "Wage Change of Coworkers: Same Pay Option + Categorical Elicitation" \ "Wage Change of Coworkers: No Same Pay Option + Open Elicitation")
     
   
